//
//  WZTabbarMainCell.swift
//  WZApp
//
//  Created by evol on 2018/6/12.
//  Copyright © 2018年 evol. All rights reserved.
//

import UIKit

class ELTabbarMainCell: UICollectionViewCell {
    
    var button = UIButton(type: .custom)
    
    var model = ELTabbarMainModel(){
        didSet {
            button.setImage( UIImage(named: model.imageName.languageValue), for: .normal)
            button.setImage(UIImage(named: model.imageName_s.languageValue), for: .selected)
            button.isSelected = model.selected
        }
    }
    
    // 分割线
    var separateView:UIImageView = {
        let separateView = UIImageView(image: UIImage(named: "tabbar_main_sep"))
        return separateView
    }()
    
    var picthOn = false {
        didSet{
            button.isSelected = picthOn
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.contentView.addSubview(button)
        button.isUserInteractionEnabled = false
        button.snp.makeConstraints { (make) in
            make.center.equalTo(self.contentView)
            make.size.equalTo(CGSize(width: SCREEN_WIDTH/5, height: tabbarHeight))
        }
        
        contentView.addSubview(separateView)
        separateView.snp.makeConstraints { (make) in
            make.right.centerY.equalTo(contentView)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
